//
//  RadioTypeTableViewCell.m
//  Slice
//
//  Created by lanou on 16/6/17.
//  Copyright © 2016年 wangjinchao. All rights reserved.
//

#import "RadioTypeTableViewCell.h"

@implementation RadioTypeTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.imgView = [[UIImageView alloc] initWithFrame:CGRectZero];
        [self addSubview:self.imgView];
        
        self.picView = [[UIImageView alloc] initWithFrame:CGRectZero];
        self.picView.image = [UIImage imageNamed:@"u58"];
        [self addSubview:self.picView];

        self.titleLable = [[UILabel alloc] initWithFrame:CGRectZero];
        [self addSubview:self.titleLable];

        self.byNameLable = [[UILabel alloc] initWithFrame:CGRectZero];
        [self addSubview:self.byNameLable];

        self.countLable = [[UILabel alloc] initWithFrame:CGRectZero];
        [self addSubview:self.countLable];
        
        self.descriLable = [[UILabel alloc] initWithFrame:CGRectZero];
        [self addSubview:self.descriLable];
    }
    return self;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    
    self.imgView.frame = CGRectMake(5, 5, 85, 110);
    
    self.titleLable.frame = CGRectMake(90, 10, kWidth - 90, 25);
    self.picView.frame = CGRectMake(kWidth - 125, 10, 25, 25);
    
    self.countLable.frame = CGRectMake(kWidth - 95, 10, 95, 25);
    self.byNameLable.frame = CGRectMake(90, 45, kWidth - 90, 25);
    self.descriLable.frame = CGRectMake(90, 80, kWidth - 90, 25);
}



//控件赋值
- (void)getDataByModel:(RadioTypeModel *)model {
    self.titleLable.text = model.title;
    self.byNameLable.text = model.userinfo[@"uname"];
    self.countLable.text = model.count.stringValue;
    self.descriLable.text = model.desc;
    [self.imgView sd_setImageWithURL:[NSURL URLWithString:model.coverimg] placeholderImage:[UIImage imageNamed:@"1.jpeg"]];
    
}



- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
